<template>
  <a-drawer
    width="45%"
    :title="formTitle"
    :label-col="4"
    :wrapper-col="14"
    :visible="open"
    :body-style="{ height: 'calc(100vh - 100px)', overflow: 'auto' }"
    @close="cancel"
  >
    <a-form-model ref="form" :model="form" :rules="rules" layout="vertical">
      <a-spin :spinning="spinning" :delay="delayTime" tip="Loading...">
        <a-row
          :gutter="32"
          style="width: 80%; margin-left: 15%; margin-top: -10px"
        >
          <a-col :span="24" style="margin-left: -120px; margin-bottom: 15px">
            <div style="display: flex; flex-direction: row">
              <span
                style="
                  width: 5px;
                  height: 22px;
                  background-color: coral;
                  display: block;
                "
              ></span>
              <span
                style="
                  margin-left: 5px;
                  height: 22px;
                  line-height: 22px;
                  font-size: 16px;
                  font-weight: 600;
                "
                >放款信息</span
              >
            </div>
          </a-col>

          <a-col :span="8">
            <a-form-model-item label="客户姓名" prop="cusName">
              <a-input-number
                v-model="form.cusName"
                :min="0"
                style="width: 100%"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="还款开始日期" prop="beginTime">
              <a-date-picker
                v-model="form.beginTime"
                valueFormat="YYYY-MM-DD"
                :show-today="true"
                placeholder="选择日期"
                style="width: 100%"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="贷款方式" prop="loanType">
              <a-select
                placeholder="请选择贷款方式"
                v-model="form.loanType"
                :getPopupContainer="
                  (triggerNode) => {
                    return triggerNode.parentNode || document.body;
                  }
                "
                style="width: 100%"
                allow-clear
                disabled
              >
                <a-select-option
                  v-for="(d, index) in loanTypeOptions"
                  :key="index"
                  :value="d.dictValue"
                  >{{ d.dictLabel }}</a-select-option
                >
              </a-select>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="到期日期" prop="endTime">
              <a-date-picker
                v-model="form.endTime"
                valueFormat="YYYY-MM-DD"
                :show-today="true"
                placeholder="选择日期"
                style="width: 100%"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="还款日" prop="payDate">
              <a-date-picker
                v-model="form.payDate"
                valueFormat="YYYY-MM-DD"
                :show-today="true"
                placeholder="选择日期"
                style="width: 100%"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="贷款月数" prop="months">
              <a-input-number
                v-model="form.months"
                :min="0"
                style="width: 100%"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="本金金额" prop="principal">
              <a-input-number
                v-model="form.principal"
                :min="0"
                style="width: 100%"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="年利率" prop="lv">
              <a-input-number
                v-model="form.lv"
                :min="0"
                style="width: 100%"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="月供金额" prop="monthPayment">
              <a-input-number
                v-model="form.monthPayment"
                :min="0"
                style="width: 100%"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="总还款额" prop="totalPayment">
              <a-input-number
                v-model="form.totalPayment"
                :min="0"
                style="width: 100%"
                disabled
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="总利息" prop="totalInterest">
              <a-input-number
                v-model="form.totalInterest"
                :min="0"
                style="width: 100%"
                disabled
              />
            </a-form-model-item>
          </a-col>

          <a-col :span="24" style="margin-left: -120px; margin-bottom: 15px">
            <div style="display: flex; flex-direction: row">
              <span
                style="
                  width: 5px;
                  height: 22px;
                  background-color: coral;
                  display: block;
                "
              ></span>
              <span
                style="
                  margin-left: 5px;
                  height: 22px;
                  line-height: 22px;
                  font-size: 16px;
                  font-weight: 600;
                "
                >还款信息</span
              >
            </div>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="是否结清" prop="isPayAll">
              <a-radio-group v-model="form.isPayAll" button-style="solid">
                <a-radio-button :value="0"> 未结清 </a-radio-button>
                <a-radio-button :value="1"> 已结清 </a-radio-button>
              </a-radio-group>
            </a-form-model-item>
          </a-col>

          <a-col :span="8">
            <a-form-model-item label="是否逾期" prop="isOverdue">
              <a-radio-group
                v-model="form.isOverdue"
                button-style="solid"
                disabled
              >
                <a-radio-button :value="0"> 未逾期 </a-radio-button>
                <a-radio-button :value="1"> 已逾期 </a-radio-button>
              </a-radio-group>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="逾期天数" prop="overdueDays">
              <a-input-number
                v-model="form.overdueDays"
                :min="0"
                style="width: 100%"
              />
            </a-form-model-item>
          </a-col>

          <a-col :span="24">
            <a-form-model-item label="逾期说明" prop="overdueRemark">
              <a-textarea
                v-model="form.overdueRemark"
                placeholder="请输入逾期说明"
                :rows="4"
              />
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-spin>
      <div class="bottom-control">
        <a-space>
          <a-button @click="cancel"> 取消 </a-button>
          <a-button type="primary" @click="submitForm"> 保存 </a-button>
        </a-space>
      </div>
    </a-form-model>
  </a-drawer>
</template>
<script>
import BizLoanBillEditForm from "./BizLoanBillForm";
export default {
  ...BizLoanBillEditForm,
};
</script>
